<script setup lang="ts">
import FooterInput from '@/views/Music/components/FooterInput.vue'
import type { 
  SongCommentObj,
  SongRepayObj

} from '@/types/Playing'
const emit = defineEmits(['onClose','onUser','onTopic','onRepay','onZan','onComment'])
defineProps<{
  comments:SongCommentObj[],
  topics:string[]
}>()
const onClose = ()=>{
  console.log('onCloseSelf')
  emit('onClose')
}

</script>

<template>

  <div class="header">
    <span class="iconfont icon-angle-up-l icon-more" @click="onClose"></span>
    <span class="title">
      评论({{ comments.length }})
    </span>
  </div>

  <div class="content">
    <div class="cell" v-for="comment in comments" :key="comment.id">
      <div class="cell-avater" :style="{backgroundImage : `url(${comment.avater})`}" @click="emit('onUser',comment)">

      </div>
      <div class="cell-content">
        <div class="name" @click="emit('onUser',comment)">
            {{ comment.name }}
        </div>
        <div class="time">
          {{ comment.time }}
        </div>
        <div class="comment" @click="emit('onComment',comment)">
          {{ comment.content }}
        </div>
        <div class="topic" v-if="comment.topic" @click="emit('onTopic',comment)">
          # {{ comment.topic![0] }}
        </div>
        <div class="repay" v-if="comment.repays" @click="emit('onRepay',comment)">
          - 查看{{comment.repays!.length}}条评论 >
        </div>
      </div>
      <div class="cell-zan" @click="emit('onZan',comment)">
        <span class="iconfont icon-zan icon"></span>
        <span class="cell-zan-count">{{ comment.zanCount }}</span>
      </div>
    </div>
  </div>

  <FooterInput class="footer" :topics="topics">
    1111
  </FooterInput>
</template>

<style lang="scss" scoped>
.header {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  background-color: #000;
  width: 100%;
  height: 10vh;
}
.title {
  font-size: 6vw;
  line-height: 10vw;
  color: white;
  background-color: transparent;
  position: absolute;
  bottom: 0;
  text-align: center;
  width: 100%;
}

.icon-more {
  font-size: 6vw;
  line-height: 10vw;
  color: white;
  background-color: transparent;
  position: absolute;
  bottom: 0;
  left: 4vw;
  z-index: 66;
}

.content {
  padding: 10vh 4vw 10vh 4vw;
  background-color: transparent;
}

.cell {
  display: flex;
  padding-bottom: 4vw;
  background-color: transparent;
}

.cell-avater {
  background-color: transparent;
  width: 10vw;
  height: 10vw;
  border-radius: 50%;
  background-size: cover;
}

.cell-content {
  flex: 1;
  padding: 0 4vw 0vw 2vw;
  background-color: transparent;
}

.cell-zan {
  background-color: transparent;
  width: 10vw;
  height: 10vw;
}
.icon {
  display: block;
  color: #fff;
  font-size: 4vw;
  background-color: transparent;
  text-align: center;
}
.cell-zan-count {
  display: block;
  color: #fff;
  font-size: 4vw;
  background-color: transparent;
  text-align: center;
}
.name {
  color: #fff;
  font-size: 4vw;
  line-height: 6vw;
  background-color: transparent;
}
.time {
  color: #fff;
  font-size: 3vw;
  line-height: 4vw;
  background-color: transparent;
}

.comment {
  color: #fff;
  font-size: 4vw;
  background-color: transparent;
  padding-top: 3vw;
}

.topic {
  display: inline-block;
  font-size: 3.5vw;
  color: #fff;
  background-color: #666;
  margin-top: 3vw;
  padding: 1vw 2vw;
  border-radius: 3vw;
  
}

.repay {
  margin-top: 4vw;
  color: #999;
  font-size: 3.5vw;
  background-color: transparent;
}

.footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #333;
  border-radius: 3vw 3vw 0 0 ;
  width: 100%;
  height: 12vh;
  z-index: 999;
}
</style>